﻿using Minecraft.Model;
using Minecraft.Model.ReqResp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Minecraft.ConnTest
{
	public class RespLevelJudge
	{
		public static void Do(EnumCommand command, BaseResp resp, Action successAction)
		{
			if (resp == null)
			{
				return;
			}
			switch (resp.RespLevel)
			{
				case RespLevelEnum.Success:
					{
						successAction();
					}
					break;
				case RespLevelEnum.Warn:
					break;
				case RespLevelEnum.Error:
					{
						Console.BackgroundColor = ConsoleColor.Red;
						Console.ForegroundColor = ConsoleColor.White;
						Console.WriteLine($"执行的命令：{command.ToString()}");
						Console.WriteLine($"错误消息：{resp.Msg}");
						Console.ResetColor();
					}
					break;
				default:
					break;
			}
		}
	}
}
